#include <iostream>
#include <windows.h>
#include <cmath>
#define PI 3.14
using namespace std;

int main(){
    int starttime;
    int busytime;
    int sinval = 0;
    while(1){
        starttime = GetTickCount();
        busytime = (int)(500 * sin(float((sinval) %= 30) / 30 * 2 * PI)) + 500;
        cout << busytime << endl;
        sinval++;
        while((int)GetTickCount() - starttime < busytime)
			;
        Sleep(1000 - busytime);
    }
    return 0;
}
